package bio.five;

import java.io.PrintStream;
import java.net.Socket;
import java.util.Scanner;

/*
    处理客户端发送消息的线程
 */
public class HandlerClientSendThread extends Thread {
    private Socket socket;

    public HandlerClientSendThread(Socket socket) {
        this.socket = socket;
    }

    @Override
    public void run() {
        try (
                //发送消息
                PrintStream ps = new PrintStream(socket.getOutputStream());
                Scanner scanner = new Scanner(System.in);
        ) {
            String msg = "";
            while (true) {
                msg = scanner.nextLine();
                ps.println(msg);
            }
        } catch (Exception e) {

        }
    }
}
